home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Languages / MacGofer 0.22d / MacGofer Sources / prelude.h < prev    next >
Encoding:
Text File  |  1994-03-31  |  17.0 KB  |  246 lines  |  [TEXT/MPS ]

  1. fine allowBreak()
  2. #endif
  3. #ifndef local
  4. #define local
  5. #endif
  6. #ifndef farCalloc
  7. #define farCalloc(n,s)       (Void *)calloc(((unsigned)n),((unsigned)s))
  8. #endif
  9. #ifndef FOPEN_WRITE
  10. #define FOPEN_WRITE       "w"
  11. #endif
  12. #ifndef FOPEN_APPEND
  13. #define FOPEN_APPEND       "a"
  14. #endif
  15. #ifndef sigProto
  16. #define sigProto(nm)       Void nm Args((int))
  17. #define sigRaise(nm)       nm(1)
  18. #define sigHandler(nm)       Void nm(sig_arg) int sig_arg;
  19. #define sigResume       return
  20. #endif
  21.  
  22. #ifndef PROMPT
  23. #define    PROMPT      "? "    /* Default Gofer Prompt */
  24. #endif
  25.  
  26. #ifndef Main            /* to cope with systems that don't like       */
  27. #define Main           Void /* main to be declared as returning Void   */
  28. #endif
  29. #ifndef MainDone
  30. #define MainDone
  31. #endif
  32.   
  33. #if (UNIX | DJGPP | RISCOS | ZTC)
  34. #define ctrlbrk(bh)       signal(SIGINT,bh)
  35. #endif
  36.  
  37. /*---------------------------------------------------------------------------
  38.  * General settings:
  39.  *-------------------------------------------------------------------------*/
  40.  
  41. #define Void     void   /* older compilers object to: typedef void Void;   */
  42. #if !MPW
  43. typedef unsigned Bool;
  44. #else
  45. typedef int Bool;    /* NB: On the Mac, Bool != Boolean, TRUE != TRUE!  KH */
  46. #endif
  47.  
  48. #define TRUE     1
  49. #define FALSE    0
  50. typedef char    *String;
  51. typedef int      Int;
  52. typedef long     Long;
  53. typedef int      Char;
  54. typedef unsigned Unsigned;
  55.  
  56. #ifndef STD_PRELUDE
  57. #if     RISCOS
  58. #define STD_PRELUDE       "prelude"
  59. #else
  60. #define STD_PRELUDE       "standard.prelude"
  61. #endif
  62. #endif
  63.  
  64. #define NUM_SYNTAX         100
  65. #define NUM_SELECTS        100
  66. #define NUM_FILES       20
  67. #define NUM_MODULES        64
  68. #define NUM_FIXUPS         100
  69. #define NUM_TUPLES         100
  70. #define NUM_OFFSETS        1024
  71. #define NUM_CHARS          256
  72.  
  73. /* Managing two different sized versions of Gofer has caused problems in
  74.  * the past for people who tried to change one setting, but inadvertantly
  75.  * modified the settings for a different size.  Now that we have three
  76.  * sizes of Gofer, I think it's time to try a new scheme:
  77.  */
  78.   
  79. #if     SMALL_GOFER            /* the McDonalds mentality :-)       */
  80. #define Pick(s,r,l)       s
  81. #endif
  82. #if     REGULAR_GOFER
  83. #define Pick(s,r,l)       r
  84. #endif
  85. #if     LARGE_GOFER
  86. #define Pick(s,r,l)       l
  87. #endif
  88.   
  89. #define NUM_TYCON          Pick(60,    160,        160)
  90. #define NUM_NAME           Pick(625,   2000,       16000)
  91. #define NUM_CLASSES        Pick(20,    40,         40)
  92. #define NUM_INSTS          Pick(60,    100,        100)
  93. #define NUM_INDEXES        Pick(700,   2000,       2000)
  94. #define NUM_DICTS          Pick(400,   32000,      32000)
  95. #define NUM_TEXT           Pick(7000,  20000,      80000)
  96. #define NUM_TEXTH       Pick(1,     10,         10)
  97. #define NUM_TYVARS         Pick(800,   3000,       4000)
  98. #define NUM_STACK          Pick(1800,  16000,      16000)
  99. #define NUM_ADDRS          Pick(28000, 100000,     320000)
  100. #define MINIMUMHEAP       Pick(7500,  7500,       7500)
  101. #define MAXIMUMHEAP       Pick(32765, 0,          0)
  102. #define DEFAULTHEAP        Pick(28000, 100000,     100000)
  103. #define MAXPOSINT          Pick(32767, 2147483647, 2147483647)
  104.   
  105. #define minRecovery       Pick(1000,  1000,       1000)
  106. #define bitsPerWord       Pick(16,    32,         32)
  107. #define wordShift       Pick(4,     5,          5)
  108. #define wordMask       Pick(15,    31,         31)
  109.  
  110. #define bitArraySize(n)    ((n)/bitsPerWord + 1)
  111. #define placeInSet(n)      ((-(n)-1)>>wordShift)
  112. #define maskInSet(n)       (1<<((-(n)-1)&wordMask))
  113.  
  114.  
  115. /* For Hex numbers, define the largest Int value to be all ones */
  116. #define MAXUNSIGNEDINT     (~0)
  117.  
  118. /*    
  119.     None of the defaults is quite right for a 2M Mac, so they have to 
  120.     be modified here.
  121.     
  122.     Since the user can set these from within the application, making them
  123.     smaller by default isn't a big deal.  This is also true for any
  124.     version compiled with DYNAMIC_STORAGE.
  125. */
  126.  
  127. #if     MPW
  128. #undef    NUM_NAME
  129. #define NUM_NAME           1000
  130. #undef    NUM_DICTS
  131. #define NUM_DICTS          16000
  132. #undef    NUM_TEXT
  133. #define NUM_TEXT           16384
  134. #undef    NUM_TYVARS
  135. #define NUM_TYVARS         2000
  136. #undef    NUM_STACK
  137. #define NUM_STACK          8000
  138. #undef    NUM_ADDRS
  139. #define NUM_ADDRS          60000
  140. #endif
  141.  
  142. #if DYNAMIC_STORAGE
  143. extern int    num_tycon, tyconhsz, num_syntax, name_hsz,
  144.         num_name, num_classes, num_stack,
  145.         num_text, texthsz, num_indexes, num_insts,
  146.         num_addrs, num_dicts, num_tuples, num_offsets,
  147.         num_selects, num_tyvars, num_fixups,
  148.         num_files, num_modules;
  149.  
  150. #else    /* Define contants equal to the above variables */
  151.  
  152. #define num_tycon      NUM_TYCON
  153. #define num_syntax     NUM_SYNTAX
  154. #define    num_name     NUM_NAME
  155. #define    num_classes     NUM_CLASSES
  156. #define    num_stack     NUM_STACK
  157. #define    num_modules     NUM_MODULES
  158. #define    num_files     NUM_FILES
  159. #define    num_text     NUM_TEXT
  160. #define    num_indexes     NUM_INDEXES
  161. #define    num_insts     NUM_INSTS
  162. #define    num_tuples    NUM_TUPLES
  163. #define    num_offsets    NUM_OFFSETS
  164. #define    num_selects    NUM_SELECTS
  165. #define    num_addrs    NUM_ADDRS
  166. #define num_dicts    NUM_DICTS
  167. #define num_tyvars    NUM_TYVARS
  168. #define num_fixups    NUM_FIXUPS
  169. #endif
  170.  
  171. #ifndef __GNUC__
  172. #if !RISCOS
  173. extern Int      strcmp     Args((String, String));
  174. extern Int      strlen     Args((String));
  175. extern char    *strcpy       Args((String,String));
  176. extern char     *strcat       Args((String,String));
  177. #endif
  178. #endif
  179. extern char    *getenv       Args((char *));
  180. extern int      system       Args((const char *));
  181. extern double   atof       Args((char *));
  182. extern char     *strchr    Args((char *,int));  /* test membership in str  */
  183. extern Void     exit       Args((Int));
  184. extern Void     internal   Args((String));
  185. extern Void     fatal       Args((String));
  186.  
  187.  
  188. /*
  189.     Note:     gcCStack() will screw up badly if sizeof(float/double) != sizeof(Cell)
  190.         and floating point values are passed by value.  This is pretty
  191.         gross since "random" memory errors will occur.  This can happen if
  192.         IEEE-488 extended precision (80-bit) values are used, for example.
  193.  
  194.         If you don't know what your compiler does, either don't use 
  195.         gcCStack(), don't use float, or redefine Floating point code
  196.         as for the Macintosh.  KH
  197. */
  198.  
  199. #if     HAS_FLOATS
  200. #ifdef  NEED_MATH
  201. #include <math.h>
  202. #endif
  203. #if !MPW
  204. #if    (REGULAR_GOFER | LARGE_GOFER) & BREAK_FLOATS
  205. #define FloatImpType       double
  206. #define FloatPro       double
  207. #define FloatFMT           "%.9g"
  208. #else
  209. #define FloatImpType       float
  210. #define FloatPro       double  /* type to use in prototypes           */
  211.                    /* strictly ansi (i.e. gcc) conforming  */
  212.                    /* but breaks data hiding :-(       */
  213. #define FloatFMT       "%g"
  214. #endif
  215.  
  216. #else
  217. #define FloatImpType       Cell    /* Wierd things happen if these are not */
  218. #define FloatPro       Cell    /* the same size as Cells! KH       */
  219. #define FloatFMT       "%g"
  220. #endif
  221.  
  222. #else
  223. #define FloatImpType       int     /*dummy*/
  224. #define FloatPro       int
  225. #define FloatFMT       "%d"
  226. #endif
  227.  
  228. #ifndef FILENAME_MAX       /* should already be defined in an ANSI compiler*/
  229. #define FILENAME_MAX 256
  230. #else
  231. #if     FILENAME_MAX < 256
  232. #undef  FILENAME_MAX
  233. #define FILENAME_MAX 256
  234. #endif
  235. #endif
  236.  
  237. #if UNIX
  238. #define DEF_EDITOR       "vi"            /* replace with ((char *)0)*/
  239. #define DEF_EDITLINE       "vi +%d %s"        /* if no default editor rqd*/
  240. #else
  241. #define DEF_EDITOR       ((char *) 0)    
  242. #define DEF_EDITLINE       ((char *) 0)
  243. #endif
  244.  
  245. /*-------------------------------------------------------------------------*/
  246.